<?php

class CompetitionAction extends AdministratorAction {
	protected $modelObj = null;
	
	public function _initialize(){
		parent::_initialize();
		$this->modelObj = D('Competition');
	}
	
	public function index(){
		load('extend');
		import('ORG.Util.Page');
		//每页显示数
		$perpage = C('PER_PAGE');
		$keyword = $this->_get('keyword');
		$where = array();
		if ( $keyword !='' ){
			$where[] = "title LIKE '%$keyword%'";
			$where[] = "description LIKE '%$keyword%'";
		}
		$where_str = implode(' OR ', $where);
		$count = $this->modelObj->where($where_str)->count();
		$Page = new Page($count,$perpage);
		$show = $Page->show();
		$videos = $this->modelObj->where($where_str)->limit($Page->firstRow.','.$Page->listRows)->select();
		$this->assign('news',$videos);
		$this->assign('page',$show);
		$this->display();
	}
	
	
	protected function _checkFormData(){
		
	}
}